package com.gitee.huanminabc.utils_tools.security.core;

import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

/**
 * 默认权限资源，不提供任何权限资源
 * @author huanmin
 * @date 2024/1/24
 */

@Component
public class DefaultAuthorityResource implements AuthorityResource{
    @Override
    public Set<String> getAuthorityResource() {
        HashSet<String> objects = new HashSet<>();
        objects.addAll(Arrays.asList(swaggerUrls));
        objects.addAll(Arrays.asList(staticResource));
        objects.addAll(Arrays.asList(securityUrls));
        return objects;
    }
    private String[] swaggerUrls = {
            "/swagger-ui.html",
            "/swagger-ui.html/**",
            "/swagger-resources/**",
            "/v2/api-docs",
            "/v3/api-docs",
            "/webjars/**"
    };

    private String[] staticResource= {
            "/**/*.css",
            "/**/*.js",
            "/images/**",
            "/fonts/**",
            "/favicon.ico",
    };
    private  String[] securityUrls= {
            "/api/user/register", //注册
            "/api/user/login", //登录
            "/api/user/refreshToken", //刷新token,
            "/api/user/createMockToken", //创建mockToken
    };
}
